package com.zr.influx.model;

import com.influxdb.annotations.Column;
import com.influxdb.annotations.Measurement;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.Instant;

/**
 * 外汇行情数据模型，使用InfluxDB注解定义测量值和字段
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Measurement(name = "forex") // 从配置文件获取测量值名称
public class ForexData {

    // 标签 - 用于索引和过滤
    @Column(tag = true)
    private String currencyPair;

    @Column(tag = true)
    private String exchange;

    // 字段 - 存储实际测量值
    @Column
    private double openPrice;

    @Column
    private double highPrice;

    @Column
    private double lowPrice;

    @Column
    private double closePrice;

    @Column
    private long volume;

    // 时间戳
    @Column(timestamp = true)
    private Instant timestamp;
}

